<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title>无标题文档</title>
</head>

<body>
	<?php 
	@mysql_connect("localhost","root","") or die("数据库服务器连接出错！");
	@mysql_select_db("data") or die("数据库选择出错！");
	
	$un=$_POST['un'];
	$up=$_POST['up'];
	$ut=$_POST['ut'];
	
	$querystr="select * from userinfo where username='$un'";
	
//	echo $querystr;
	
	$result=mysql_query($querystr) or die("数据库操作出错A！");
	
	if ($arr=mysql_fetch_array($result)){
		echo "用户名已经存在，请重新<A href='zhuce.html'>注册</A>！";
	}
	else{
		$querystr="INSERT INTO userinfo (`username`, `userpass` , `usertype`) VALUES ('$un', '$up' , '$ut')";

		$result=mysql_query($querystr) or die("数据库操作出错B！");

		echo "注册成功，请<a href='denglu.html'>登录</a>！";
	}
	
	mysql_close();
	?>
</body>
</html>
